﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;

namespace GUI
{
    public partial class FormChiTietDonHang : Form
    {
        public string maDonHang;
        public string run = "";

        public FormChiTietDonHang()
        {
            InitializeComponent();
        }

        private void FormChiTietDonHang_Load(object sender, EventArgs e)
        {
            //load thong tin don hang :
            DonHangDTO donhangDTO = DonHangBUS.ThongTinDonHang(maDonHang, run);

            if (donhangDTO != null)
            {
                int makhachhang = donhangDTO.MaKhachHang;
                KhachHangDTO khachhangDTO = KhachHangBUS.ThongTinTaiKhoan(makhachhang);
                lbMaDonHang.Text = maDonHang;
                lbMaSanPham.Text = SanPhamBUS.ThongTinSanPham(donhangDTO.MaSanPham);
                lbNgayHetHan.Text = donhangDTO.NgayHetHan.ToString("dd/MM/yyyy");
                lbNgayMua.Text = donhangDTO.NgayMua.ToString("dd/MM/yyyy");
                lbThanhTien.Text = string.Format("{0:#,0.##}", donhangDTO.ThanhTien);
                lbTinhTrang.Text = donhangDTO.TinhTrang;
                lbKhachHang.Text = KhachHangBUS.ThongTinTaiKhoan(donhangDTO.MaKhachHang).Email;
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void FormChiTietDonHang_Resize(object sender, EventArgs e)
        {
            pnMain.Location = new Point((this.Width - pnMain.Width) / 2, pnMain.Location.Y);
        }
    }
}
